package com.tms.project.tms.train.service.impl;

import java.util.List;
import com.tms.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tms.project.tms.train.mapper.TeacherTrainMapper;
import com.tms.project.tms.train.domain.TeacherTrain;
import com.tms.project.tms.train.service.ITeacherTrainService;
import com.tms.common.utils.text.Convert;

/**
 * 教师培训信息Service业务层处理
 * 
 * @author xyl
 * @date 2021-03-23
 */
@Service
public class TeacherTrainServiceImpl implements ITeacherTrainService 
{
    @Autowired
    private TeacherTrainMapper teacherTrainMapper;

    /**
     * 查询教师培训信息
     * 
     * @param trainId 教师培训信息ID
     * @return 教师培训信息
     */
    @Override
    public TeacherTrain selectTeacherTrainById(Long trainId)
    {
        return teacherTrainMapper.selectTeacherTrainById(trainId);
    }

    /**
     * 查询教师培训信息列表
     * 
     * @param teacherTrain 教师培训信息
     * @return 教师培训信息
     */
    @Override
    public List<TeacherTrain> selectTeacherTrainList(TeacherTrain teacherTrain)
    {
        return teacherTrainMapper.selectTeacherTrainList(teacherTrain);
    }

    /**
     * 新增教师培训信息
     * 
     * @param teacherTrain 教师培训信息
     * @return 结果
     */
    @Override
    public int insertTeacherTrain(TeacherTrain teacherTrain)
    {
        teacherTrain.setCreateTime(DateUtils.getNowDate());
        return teacherTrainMapper.insertTeacherTrain(teacherTrain);
    }

    /**
     * 修改教师培训信息
     * 
     * @param teacherTrain 教师培训信息
     * @return 结果
     */
    @Override
    public int updateTeacherTrain(TeacherTrain teacherTrain)
    {
        teacherTrain.setUpdateTime(DateUtils.getNowDate());
        return teacherTrainMapper.updateTeacherTrain(teacherTrain);
    }

    /**
     * 删除教师培训信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTeacherTrainByIds(String ids)
    {
        return teacherTrainMapper.deleteTeacherTrainByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除教师培训信息信息
     * 
     * @param trainId 教师培训信息ID
     * @return 结果
     */
    @Override
    public int deleteTeacherTrainById(Long trainId)
    {
        return teacherTrainMapper.deleteTeacherTrainById(trainId);
    }
}
